package com.xiaomaoguai.jdk.concurent.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

/**
 * @Description :
 * @FileName: Main.java
 * @Author :WeiHui.Zhang
 * @Data : 2015年6月30日 上午10:13:26
 * @Version:V1.00
 */
public class Main {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		FutureTask<String> futureTask = new FutureTask<String>(new RealData("a"));

		ExecutorService executorService = Executors.newFixedThreadPool(1);

		executorService.submit(futureTask);

		System.out.println("请求完毕");

		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		System.out.println("数据：" + futureTask.get());
	}
}
